# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Josip Ponjavic <josipponjavic at gmail dot com>
# Contributor: Xu Fasheng <fasheng.xu[AT]gmail.com>

pkgname=deepin-mutter
pkgver=3.20.38
pkgrel=6
pkgdesc="Base window manager for deepin, fork of gnome mutter"
arch=('loong64' 'x86_64')
url="https://github.com/linuxdeepin/deepin-mutter"
license=('GPL3')
depends=('deepin-clutter' 'dconf' 'gobject-introspection-runtime' 'deepin-desktop-schemas'
         'libcanberra' 'startup-notification' 'zenity' 'libsm' 'gnome-desktop' 'upower'
         'libxkbcommon-x11' 'libgudev' 'deepin-cogl' 'libxkbfile')
makedepends=('gnome-common' 'gobject-introspection' 'gtk-doc' 'intltool' 'wayland-protocols')
options=('!emptydirs' 'debug')
source=("$pkgname-$pkgver.tar.gz::https://github.com/linuxdeepin/deepin-mutter/archive/$pkgver.tar.gz")
sha512sums=('19aa7c56bfde874ba58622c8c6928999020dcfce9dc30d7982ea53ef4d91f06ec90ed605d6ff4eaa6bd81181c52e8d5e693a4f4aecd9e790c3bc5d34464e6cce')

prepare() {
  cd deepin-mutter-$pkgver
  sed -i '/SCANNERFLAGS/s/ --warn-error//' src/Makefile.am
}

build() {
  cd deepin-mutter-$pkgver
  ./autogen.sh \
    --prefix=/usr \
    --sysconfdir=/etc \
    --libexecdir=/usr/lib/deepin-mutter \
    --localstatedir=/var \
    --enable-gtk-doc \
    --enable-wayland \
    --enable-native-backend \
    --disable-static \
    --disable-schemas-compile \
    --enable-compile-warnings=minimum
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd deepin-mutter-$pkgver
  make DESTDIR="$pkgdir" install
}
